#ifndef _ELEMENTS_ABUTTON_H_
# define _ELEMENTS_ABUTTON_H_

# include "config.h"
# include <string>
# include <SDL/SDL.h>
# include "UTILS\\Rect.h"
# include "UTILS\\Font.h"
# include "UTILS\\Surface.h"
# include "UTILS\\ResGroupManager.h"
# include "Elements\\Label.h"
# include "Elements\\AElement.h"

NS_BEGIN(SDL)
	NS_BEGIN(BUTTON)

	enum STATE
	{
		RELEASED = 0,
		HOVERED = 1,
		PRESSED = 2,
		CLICKED = 3,
		COUNT
	};

	NS_END(BUTTON)

	NS_BEGIN(ELEMENTS)

	class AButton : public AElement
	{
	protected:
		BUTTON::STATE m_state;
		UTILS::Surface* m_imgReleased;
		UTILS::Surface* m_imgHovered;
		UTILS::Surface* m_imgPressed;
		UTILS::Surface* m_imgClicked;
		UTILS::Surface* m_imgDisabled;
		Label m_text;
		UTILS::ResGroup* m_resGroup;

	protected:
		AButton(std::wstring const& _text);
		AButton(AButton const& _abutton);
		~AButton();

	public:
		AButton& operator=(AButton const&);
		bool operator==(AButton const& _abutton) const;
		bool operator!=(AButton const& _abutton) const;

		virtual void UpdateState() = 0;
		virtual bool Draw(SDL_Surface* _screen) = 0;
		virtual void SetPosition(Sint16 _x, Sint16 _y) = 0;
		virtual void SetPosition(UTILS::Rect const& _position) = 0;
		virtual void Move(Sint16 _offsetX, Sint16 _offsetY) = 0;
		virtual void Move(UTILS::Rect const& _offset) = 0;

		BUTTON::STATE GetState() const;
		void SetState(BUTTON::STATE _state);
		std::wstring const& GetText() const;
		virtual void SetText(std::wstring const& _text) = 0;
		Label const& GetLabel() const;
		UTILS::Font* GetFont() const;
		void SetFont(UTILS::Font* _font);
		UTILS::ResGroup* GetResGroup() const;
		void SetResGroup(UTILS::ResGroup* _resGroup);

	public:
		__declspec(property(get=GetState, put=SetState)) BUTTON::STATE state;
		__declspec(property(get=GetLabel)) Label label;
		__declspec(property(get=GetFont, put=SetFont)) UTILS::Font* font;
	};

	NS_END(ELEMENTS)
NS_END(SDL)

#endif // _ELEMENTS_ABUTTON_H_
